home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes reversed ƒ / Circular wipe reversed.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.6 KB  |  100 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 2
  4. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  5. #define theWindowWidth (boundsRect.right-boundsRect.left)
  6.  
  7. pascal short CircularWipeReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  8.  
  9. /* Trace a region from the center to the topleft corner, down <BlockSize> pixels,
  10.    and back to the center.  Fill that in and move the region parameters +BlockSize.
  11.    Repeat for all sides (counterclockwise). */
  12.  
  13. pascal short CircularWipeReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  14. {
  15.     RgnHandle    curregion;
  16.     short            cx,cy,lastx,lasty;
  17.     short            BlockSize;
  18.     
  19.     BlockSize=theWindowWidth/40;
  20.     cx = boundsRect.left + theWindowWidth / 2;
  21.     cy = boundsRect.top + theWindowHeight / 2;
  22.  
  23.     curregion=NewRgn();
  24.     lasty=boundsRect.top;
  25.     do                                            /* left quadrant */
  26.     {
  27.         StartTiming();
  28.         SetEmptyRgn(curregion);
  29.         MoveTo(cx,cy);
  30.         OpenRgn();
  31.             LineTo(boundsRect.left,lasty);
  32.             Line(0, BlockSize);
  33.             LineTo(cx,cy);
  34.         CloseRgn(curregion);
  35.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  36.             &boundsRect, &boundsRect, 0, curregion);
  37.         lasty+=BlockSize;
  38.         TimeCorrection(CorrectTime);
  39.     }
  40.     while (lasty<boundsRect.bottom);
  41.     
  42.     lastx=boundsRect.left;
  43.     do                                            /* bottom quadrant */
  44.     {
  45.         StartTiming();
  46.         SetEmptyRgn(curregion);
  47.         MoveTo(cx,cy);
  48.         OpenRgn();
  49.             LineTo(lastx,boundsRect.bottom);
  50.             Line(BlockSize, 0);
  51.             LineTo(cx,cy);
  52.         CloseRgn(curregion);
  53.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  54.             &boundsRect, &boundsRect, 0, curregion);
  55.         lastx+=BlockSize;
  56.         TimeCorrection(CorrectTime);
  57.     }
  58.     while (lastx<boundsRect.right);
  59.     
  60.     lasty=boundsRect.bottom;
  61.     do                                            /* right quadrant */
  62.     {
  63.         StartTiming();
  64.         SetEmptyRgn(curregion);
  65.         MoveTo(cx,cy);
  66.         OpenRgn();
  67.             LineTo(boundsRect.right,lasty);
  68.             Line(0,-BlockSize);
  69.             LineTo(cx,cy);
  70.         CloseRgn(curregion);
  71.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  72.             &boundsRect, &boundsRect, 0, curregion);
  73.         lasty-=BlockSize;
  74.         TimeCorrection(CorrectTime);
  75.     }
  76.     while (lasty>boundsRect.top-BlockSize);
  77.     
  78.     lastx=boundsRect.right;
  79.     do                                            /* top quadrant */
  80.     {
  81.         StartTiming();
  82.         SetEmptyRgn(curregion);
  83.         MoveTo(cx,cy);
  84.         OpenRgn();
  85.             LineTo(lastx,boundsRect.top);
  86.             Line(-BlockSize,0);
  87.             LineTo(cx,cy);
  88.         CloseRgn(curregion);
  89.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  90.             &boundsRect, &boundsRect, 0, curregion);
  91.         lastx-=BlockSize;
  92.         TimeCorrection(CorrectTime);
  93.     }
  94.     while (lastx>boundsRect.left-BlockSize);
  95.     
  96.     DisposeRgn(curregion);
  97.     
  98.     return 0;
  99. }
  100.